<template>
  <div class="contanier">
    <view class="uni-margin-wrap">
      <swiper id="swiper-view" class="swiper">
        <swiper-item v-for="(item, i) in swiperArr" :key="i">
          <image class="banner" :src="item.image" mode="widthFix"></image>
        </swiper-item>
      </swiper>
    </view>
    <div class="content">
      <div class="menu">
        <div class="row">
          <image src="/static/menu1.png" mode="widthFix"></image>
          <image src="/static/menu2.png" mode="widthFix"></image>
        </div>
        <div class="row">
          <image src="/static/menu3.png" mode="widthFix"></image>
          <image src="/static/menu4.png" mode="widthFix"></image>
        </div>
        <div class="row">
          <image src="/static/menu5.png" mode="widthFix"></image>
        </div>
      </div>
      <div class="card">
        <div class="card-head">
          <div class="card-head_title">精选视频</div>
          <image src="/static/look.png" style="width: 32rpx;height: 32rpx;"></image>
        </div>
        <div class="video">
          <image src="/static/video.png" mode="widthFix"></image>
          <image class="bofang" src="/static/bofang.png" mode=""></image>
        </div>
      </div>
      <div class="card recommend">
        <div class="card-head">
          <div class="card-head_title">周边推荐</div>
          <image src="/static/look.png" style="width: 32rpx;height: 32rpx;"></image>
        </div>
        <div class="card-tab">
          <div :class="recommendTabIndex===index?'item active':'item'" v-for="(item,index) in recommendTab" :key="index"
            @click="recommendTabChange(index)">{{item}}</div>
        </div>
        <div class="card-main">
            <div class="card-main-item" :class="index >0?'animate':''" v-for="(item,index) in recommend" :key="index">
              <div class="left">
                <image :src="item.image" style="width: 266rpx;height: 212rpx;border-radius: 20rpx;"></image>
              </div>
              <div class="right">
                <div>
                  <div class="name">{{item.name}}</div>
                  <div class="address">
                    <image src="/static/address.png" style="width: 32rpx;height: 32rpx;"></image>
                    <text>{{item.address}}</text>
                  </div>
                </div>
                <div class="button">
                  <div class="tag">
                    <div class="tag-item" v-for="(item2,index2) in item.tag" :key="index2">{{item2}}
                    </div>
                  </div>
                  <div class="btn" @click="handleNavigation(item.address, item.lat, item.lng)">到这去</div>
                </div>
              </div>
            </div>
        </div>
      </div>
      <div class="logo">
        <image src="/static/logo.png"></image>
      </div>
    </div>
    <!-- <image src="/static/group.png" class="group"></image> -->
    <div class="footer">
      <image class="bg" src="/static/footer.png"></image>
      <div class="tab">
        <div class="left" @click="tabChange(0)">
          <image v-if="activeIndex===0" src="/static/home-active.png"></image>
          <image v-else src="/static/home.png"></image>
          <text>首页</text>
        </div>
        <div class="center" @click="tabChange(1)">
          <image v-if="activeIndex===1" src="/static/code-active.png"></image>
          <image v-else src="/static/code.png"></image>
        </div>
        <div class="right" @click="tabChange(2)">
          <image v-if="activeIndex===2" src="/static/share-active.png"></image>
          <image v-else src="/static/share.png"></image>
          <text>分享海报</text>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
	export default {
		data() {
			return {
				recommend: [],
				recommend1: [{
						name: "AROMA",
						address: "广州康莱德酒店8楼",
						tag: ["广州塔景"],
						image: '/static/image.png',
						lat:23.115793,
						lng:113.331820
					},
					{
						name: "YUN PAVILION",
						address: "广州康莱德酒店8楼",
						tag: ["粤菜"],
						image: '/static/image1.png',
						lat:23.115793,
						lng:113.331820
					},
					{
						name: "SENSE",
						address: "广州康莱德酒店12楼",
						tag: ["全球美食"],
						image: '/static/image2.png',
						lat:23.115793,
						lng:113.331820
					},
					{
						name: "THE GEM LOUNGE",
						address: "广州康莱德酒店1楼大厅",
						tag: ["下午茶", "咖啡"],
						image: '/static/image3.png',
						lat:23.115793,
						lng:113.331820
					},
				],
				recommend2: [{
					name: "MG BAR(镁吧)",
					address: "广州康莱德酒店6层镁吧",
					tag: ["广州塔景"],
					image: '/static/image.png',
					lat:23.115793,
					lng:113.331820
				}, ],
				recommend3: [{
					name: "THE GEMLOUNGE（玲珑大楼）",
					address: "广州康莱德酒店8楼",
					tag: ["广州塔景"],
					image: '/static/image2.png',
					lat:23.115793,
					lng:113.331820
				}, ],
				recommendTab: ["美食", "酒吧", "大堂"],
				recommendTabIndex: 0,
				activeIndex: 0,
        swiperArr: [
          {
            image: "/static/kv.png"
          },
          {
            image: "/static/kv1.png"
          }
        ]
			}
		},
		onLoad() {
			this.recommend = this.recommend1
		},
		methods: {
			tabChange(index) {
				this.activeIndex = index
			},
			recommendTabChange(index) {
				this.recommendTabIndex = index
				this.recommend = this['recommend' + (index + 1)]
			},
			
			handleNavigation(address, lat, lng) {
			  uni.openLocation({
			    latitude: lat - 0,
			    longitude: lng - 0,
			    address,
			    success() {
					console.log('success')
				},
			    fail(err) {
					console.log(err,'err')
				},
			  });
			},
		}
	}
</script>

<style scoped lang="scss">
	.banner {
		width: 100%;
	}

	.swiper {
		width: 100%;
		height: 422rpx;
	}

	.content {
		font-size: 24rpx;
		color: rgb(51, 51, 51);
		font-family: 思源黑体 CN;
		margin: 0 40rpx;
	}

	.menu {
		width: 100%;
		margin-top: 40rpx;

		.row {
			display: flex;
			justify-content: space-between;

			image {
				width: 100%;
			}

			image:nth-child(2) {
				margin-left: 30rpx;
				margin-bottom: 30rpx;
			}
		}

		.row:nth-last-child(1) {
			image {
				width: 100%;
			}
		}

		.submenu:nth-last-child(1) {
			flex: 2;
		}
	}

	.card {
		&-head {
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-size: 34rpx;
			font-weight: 500;
			margin-top: 62rpx;
			margin-bottom: 24rpx;
		}

		.video {
			position: relative;
			image {
				width: 100%;
			}
			.bofang{
				position: absolute;
				top: 50%;
				left: 50%;
				transform: translate(-50%, -50%);
				width: 80rpx;
				height: 80rpx;
			}
		}

	}



	.recommend {
		.card-tab {
			display: flex;

			.item {
				width: 132rpx;
				height: 56rpx;
				line-height: 56rpx;
				margin-right: 24rpx;
				text-align: center;
				box-sizing: border-box;
				border: 0.5px solid rgba(0, 0, 0, 0.12);
				border-radius: 18px;
				background: rgb(255, 255, 255);
			}

			.active {
				color: rgb(244, 234, 200);
				border-radius: 18px;
				background: linear-gradient(90.00deg, rgb(118, 16, 11), rgb(205, 32, 17) 100%);
			}
		}
     @keyframes slideIn {
       from {
         transform: translateX(-10%);
       }
  
       to {
         transform: translateX(0);
       }
     }
		.card-main {
			margin-top: 40rpx;
       .animate{
        animation: slideIn 500ms ease-out;
       }
			.card-main-item {
				margin-top: 48rpx;
				display: flex;

				&:nth-child(1) {
					margin-top: 0rpx;
				}

				.left {
					margin-right: 32rpx;

					image {
						display: block;
					}
				}

				.right {
					flex: 1;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.name {
						color: rgb(51, 51, 51);
						font-family: 思源黑体 CN;
						font-size: 28rpx;
						letter-spacing: 0px;
						text-align: left;
					}

					.address {
						display: flex;
						align-items: center;
						margin-top: 10rpx;
					}

					.button {
						display: flex;
						justify-content: space-between;
						align-items: flex-end;

						.tag {
							color: rgb(153, 153, 153);
							font-family: PingFang SC;
							font-size: 24rpx;
							display: flex;

							&-item {
								height: 38rpx;
								line-height: 38rpx;
								border: 0.5px solid rgba(0, 0, 0, 0.16);
								border-radius: 4rpx;
								padding: 0 8rpx;
								margin-left: 16rpx;

								&:nth-child(1) {
									margin: 0;
								}
							}
						}

						.address {
							margin-top: 6rpx;
							color: rgb(112, 112, 112);
							font-family: PingFang SC;
							font-size: 24rpx;
							font-weight: 400;
						}

						.btn {
							width: 144rpx;
							height: 64rpx;
							border-radius: 20px;
							box-shadow: 0px 4px 6px 0px rgba(188, 155, 106, 0.24);
							background: linear-gradient(270.00deg, rgb(118, 16, 11), rgb(205, 32, 17) 100%);
							color: rgb(244, 234, 200);
							font-family: PingFang SC;
							font-size: 28rpx;
							font-weight: 500;
							line-height: 64rpx;
							letter-spacing: 0px;
							text-align: center;
						}
					}
				}
			}

		}
	}

	.logo {
		margin-top: 64rpx;
		padding-bottom: 256rpx;

		image {
			display: block;
			width: 232rpx;
			height: 28rpx;
			margin-right: 20rpx;
			margin: 0 auto;
		}
	}

	.group {
		position: fixed;
		bottom: 260rpx;
		right: 40rpx;
		display: block;
		width: 88rpx;
		height: 94rpx;
	}

	.footer {
		position: fixed;
		bottom: 0;
		width: 100%;

		.bg {
			display: block;
			width: 100%;
			height: 206rpx;
		}

		.tab {
			width: 100%;
			display: flex;
			justify-content: space-between;
			align-items: flex-end;
			position: absolute;
			top: 16rpx;
			color: rgb(93, 16, 12);
			font-family: 思源黑体 CN;
			font-size: 20rpx;
			font-weight: 500;
			padding: 0 80rpx;
			box-sizing: border-box;

			&>div {
				display: flex;
				flex-direction: column;
				align-items: center;
				width: 120rpx;
			}

			.left,
			.right {
				image {
					margin-top: 10rpx;
					display: block;
					width: 48rpx;
					height: 48rpx;
				}
			}

			.center {
				image {
					display: block;
					width: 110rpx;
					height: 110rpx;
				}
			}
		}
	}
</style>